<script>
import MAIN_STORE from '@/store/store.js'
import SearchBuffer from './modules/search-buffer.vue'
export default {
  /**
   * 图层工具方法
   * 条件 范围 缓冲区查询
  */
  name: "layer-tool-search",
  components: {
    SearchBuffer
  },
  data() {
    return {
      visibleBuffer: false
    }
  },
  computed: {
  },
  watch: {
  },
  mounted() {
  },
  beforeUnmount() {
  },
  methods: {
    closeSearchBuffer() {
      document.getElementById('holder-element').focus();
      this.visibleBuffer = false;
    }
  },
};
</script>

<template>
  <div class="layer-tool-container" id="search-holder" :class="[
    ['Search', 'Decision'].indexOf($route.name) !== -1 ? 'show' : ''
  ]">
    <div class="layer-tool-group">
      <div class="layer-tool-item">
        <div class="icon">
          <i class="iconfont-pipe icon-pipe-tiaojian"></i>
        </div>
        <span class="title font-alimamashuheiti">条件查询</span>
      </div>
      <div class="layer-tool-item">
        <div class="icon">
          <i class="iconfont-pipe icon-pipe-fanwei"></i>
        </div>
        <span class="title font-alimamashuheiti">范围查询</span>
      </div>
      <el-popover tabindex="-1" :visible="visibleBuffer" placement="right-start" :width="550" trigger="click">
        <template #reference>
          <div class="layer-tool-item" @click="() => { visibleBuffer = true; }">
            <div class="icon">
              <i class="iconfont-pipe icon-pipe-huanchongqu"></i>
            </div>
            <span class="title font-alimamashuheiti">缓冲区</span>
          </div>
        </template>
        <div class="">
          <search-buffer :visible="visibleBuffer" @close="closeSearchBuffer" />
        </div>
      </el-popover>
    </div>
    
  </div>
</template>
<style lang="less" scoped>
.layer-tool-container {
  pointer-events: all;
  position: fixed;
  width: 6rem;
  top: 11rem;
  left: 10rem;
  display: none;

  &.show {
    display: initial;
  }

  &>.layer-tool-group {
    background-color: #fff;
    box-shadow: 0 0 0 0.5rem rgba(255, 255, 255, 0.2);

    &>.layer-tool-item {
      cursor: pointer;
      height: 6rem;
      text-align: center;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      transition: all .3s;

      &:not(:last-of-type) {
        border-bottom: 1px dashed #afafaf;
      }

      &:hover {
        background-color: rgba(33, 104, 178, .2);

        &>span {
          color: #2168b2;
        }
      }

      &>.icon {
        font-size: 2.4rem;
        color: #2168b2;
      }

      &>span {
        font-size: 1.2rem;
      }
    }
  }
}
</style>